#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
void In_Output(int x[][5]);//函数声明
int Cal(int x[][5]);//函数声明

int main()
{
	int arr[3][5] = { 0 };
	In_Output(arr);
	printf("该数组对角线数之和为：\n%d", Cal(arr));
	return 0;
}
void In_Output(int x[][5])
{
	int i = 0;
	int j = 0;
	printf("Please input numbers:\n");
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 5; j++)
		{
			scanf("%d", &x[i][j]);
		}
	}
	printf("The array is :\n");
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 5; j++)
		{
			printf("%3d",x[i][j]);
		}
		printf("\n");
	}
}
int Cal(int x[][5])
{
	int i = 0;
	int j = 0;
	int sum = 0;
	for (i = 0; i < 3; i++)
	{
		if (0 == i|| 2 == i)
		{
			sum += (x[i][0] + x[i][4]);
		}
		if (1 == i)
		{
			sum += x[i][2];
		}
	}
	return sum;
}